﻿<Window x:Class="RetemplatedButtonDemo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Retemplated Button Demo" Height="300" Width="300" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
	<Window.Resources>
		<Style x:Key="ButtonFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Ellipse Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="-5" SnapsToDevicePixels="true"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="CoolButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Grid>
							<Ellipse x:Name="ellipseOuter" Stroke="#FF000000">
								<Ellipse.Fill>
									<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
										<GradientStop Color="#FF0035C6" Offset="0"/>
										<GradientStop Color="#FF088F6F" Offset="1"/>
									</LinearGradientBrush>
								</Ellipse.Fill>
							</Ellipse>
							<Ellipse Stroke="#FF000000" Width="Auto" Height="Auto" Margin="10,10,10,10">
								<Ellipse.Fill>
									<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
										<GradientStop Color="#FF7EB9B3" Offset="0"/>
										<GradientStop Color="#FF010807" Offset="0.973"/>
									</LinearGradientBrush>
								</Ellipse.Fill>
							</Ellipse>
							<Viewbox Margin="20,20,20,20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
								<ContentPresenter/>
							</Viewbox>
						</Grid>
						<ControlTemplate.Triggers>
						
							<Trigger Property="IsMouseOver" Value="true">
								<Setter TargetName="ellipseOuter" Property="Fill" Value="Blue" />
							</Trigger>
							<Trigger Property="Button.IsPressed" Value="True">
								<Setter Property="RenderTransform">
									<Setter.Value>
										<TransformGroup>
											<ScaleTransform ScaleX="0.9" ScaleY="0.9"/>
										</TransformGroup>
									</Setter.Value>
								</Setter>
                                <Setter Property="RenderTransformOrigin" Value=".5,.5" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Resources>
    <Grid>
        
    	<Button HorizontalAlignment="Left" Margin="13.798,12.679,0,0" VerticalAlignment="Top" Content="Button"/>
    	<Button Style="{DynamicResource CoolButtonStyle}" Content="How Cool" Foreground="White" Margin="8,12,2,0" Width="100" Height="100" />
        
    </Grid>
</Window>
